<template>
  <div class="temp-dec">
    <div class="title">
      <span>风向</span>
      <span>{{val }}°</span>
    </div>
    <div class="box">
      <div class="bg">
        <img src="./img/panel.png" class="panel"/>
        <img src="./img/dir-arrow.png" class="arrow" :style="{'transform': `rotate(${val}deg)`}"/>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    name: 'temp01',
    data () {
      return {
        val: 45
      };
    },
    props: {
      max: {
        default: 600 // 最大量程
      },
      min: {
        default: 0 // 最小量程
      },
      unit: {
        default: 'cm'
      }
    },
    computed: {
      // 高度94， 总共15格计算出每一个格子px
      kd () {
        return `${(this.val / (this.max - this.min)) * 100}%`;
      }
    },
    methods: {
    }
  };
</script>
<style lang="scss" scoped>
  .temp-dec {
    width: 130px;
    height: 130px;
    padding: 5px;
    background: #102c58;
    .title {
      display: flex;
      justify-content: space-between;
      text-align: left;
      span {
        color: #ccc;
      }
      span:nth-child(2) {
        color: #fff;
        font-size: 16px;
      }
    }
    .box {
      display: flex;
      justify-content: center;
      .bg {
        position: relative;
        width: 100px;
        height: 100px;
        img {
          width: 100%;
          border-radius: 300px;
        }
        .arrow {
          position: absolute;
          top: 0;
          left: 0;
        }
      }
    }
  }
</style>